package cn.csdj.sism.service.impl;

import cn.csdj.sism.dao.StudentscoreMapper;
import cn.csdj.sism.pojo.Student;
import cn.csdj.sism.pojo.Studentscore;
import cn.csdj.sism.service.StudentscoreService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
 * @author 李心怡
 * 2023/4/10
 */
@Service
public class StudentscoreServiceImpl implements StudentscoreService {
    @Autowired
    private StudentscoreMapper studentscoreMapper;
    @Override
    public int insert(Studentscore studentscore) {
        studentscore.setExamTime(studentscore.getExamTime().substring(0,studentscore.getExamTime().indexOf("T")));
        return studentscoreMapper.insert(studentscore);
    }

    @Override
    public int deleteById(Integer id) {
        return studentscoreMapper.deleteById(id);
    }

    @Override
    public int update(Studentscore studentscore) {
        return studentscoreMapper.updateById(studentscore);
    }

    @Override
    public Studentscore selectById(Integer id) {
        return studentscoreMapper.selectById(id);
    }

    @Override
    public List<Studentscore> selectAll() {
        return studentscoreMapper.selectList(null);
    }


    public IPage<Studentscore> selectPages(Integer current, Integer pageSize) {
        IPage<Studentscore> page = new Page(current,pageSize);
        studentscoreMapper.selectPage(page,null);
        return page;//返回数据
    }
}
